package SingleTon;

//饿汉模式
class Singleton2{
    private static  Singleton2 instance = new Singleton2();
    private Singleton2(){
    }
    public static  Singleton2 getInstance(){
        return instance;
    }

}
public class demo2 {
    public static void main(String[] args) {
        Singleton2 s1 =  Singleton2.getInstance();
        Singleton2 s2 =  Singleton2.getInstance();

        System.out.println(s1==s2);
    }
}

